package priv.ln.communication.exer;

/**
 * ClassName: Producer
 * Package: priv.ln.communication.exer
 * Description:
 * 生产者类
 * @Author 辣辣
 * @Create 2024/7/21 15:32
 * @Version 1.0
 */
public class Producer implements Runnable {
    private Clerk clerk;//共享数据类声明为私有属性

    public Producer(Clerk clerk){
        this.clerk = clerk;
    }

    @Override
    public void run() {

        while(true){
            System.out.println("生产者开始生产产品...");

            try {
                Thread.sleep(50);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

            clerk.addProduct();

        }

    }

}
